package GUI_Data.Staff;

import Data_Flow.GetData;
import Data_Structure.DataType.MyFlight;
import lombok.Data;

import javax.swing.*;
import java.awt.*;
import java.util.HashMap;

/**
 * This class contains all the Labels, text fields and the variables needed in GUI logic.
 * @author Chunxi Lin
 */
@Data
public class AllLabelAndTextFieldStaff {

    private JLabel flightLabel = new JLabel("                    Passenger list of the flight");
    private String[][] passengerList;
    private static final String[] passengerListColumnTitle = {"Passenger Name", "Passenger ID Number", "Check In"};
    private JTable passengerTable;

    private JTextField num = new JTextField(80);
    public JLabel input_flightNum = new JLabel("Please enter flight number you want to check:");

    private JLabel welcome = new JLabel("Welcome");

    /**
     * The generator of AllLabelAndTextField
     * Initialize all labels and text fields on the login page.
     * @param staff The staff frame which contains this class
     */
    public AllLabelAndTextFieldStaff(Staff staff){
        Font fontInput = new Font("Arial", Font.ROMAN_BASELINE , 50);
        input_flightNum.setFont(fontInput);

        num.setBorder(BorderFactory.createTitledBorder("Flight number:"));

        Font font = new Font("Arial", Font.ROMAN_BASELINE, 50);
        flightLabel.setFont(font);
    }

    /**
     * This method is called when you input target flight number.
     * Used to generate a passenger list for selection
     * @param getData Used to generate a passenger list for selection.
     */
    public void preInit(GetData getData){
        passengerList = getData.getTravellerData();
        passengerTable = new JTable(passengerList,passengerListColumnTitle);
    }
}
